import Vue from 'vue'
import VueRouter, { RouteConfig } from 'vue-router'
import Home from '../views/Home.vue'
import Main from '../views/main.vue'
// import CourseList from '../views/courses/CourseList.vue'
// import CourseEdit from '../views/courses/CourseEdit.vue'
import ResourceCrud from '../views/ResourceCrud.vue'

Vue.use(VueRouter)

const routes: Array<RouteConfig> = [
  {
    path: '/',
    name: 'Main',
    component: Main,
    children: [
      { path: '/', name: 'Home', component: Home },
      {
        path: '/:resource/list',
        name: 'courses-crud',
        component: ResourceCrud,
        props: true
      }
      // { path: '/courses/list', name: 'courses-list', component: CourseList },
      // {
      //   path: '/courses/create',
      //   name: 'courses-create',
      //   component: CourseEdit
      // },
      // {
      //   path: '/courses/edit/:id',
      //   name: 'courses-edit',
      //   component: CourseEdit,
      //   props: true
      // }
    ]
  }
]

const router = new VueRouter({
  mode: 'history',
  base: process.env.BASE_URL,
  routes
})

export default router
